<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* #d2 {
      user-select: none;
    } */
    body {
      user-select: none;
    }
  </style>
</head>

<body>
  <div>
    <div id="d1">文字可以选中</div>
    <div id="d2">文字不可以选中</div>
  </div>

</body>

</html>